<? require("required/dbconnect.php"); ?>
<?
	$id=$_GET['id'];
	
?>

<table width="100%" cellpadding="6" cellspacing="0" >
 
  
  <tr>
    <td align="center" valign="top" colspan="2" >
    	<table width="100%" align="center">
        	<td align="center">
		<?
			if(!empty($_SESSION['loginid']))
			{
			$member_id=$_SESSION['loginid'];
			$chk=mysql_query("select count(*)as result from os_favorite where pid=$id and uid=$member_id")or die(mysql_error());
			
			$get_pro=mysql_query("select product_name_chn from os_products where id=$id");
			if(mysql_result($chk,0,"result")>0)
			{
		?>
		
			<div class="dw_failed">This product is already part of your wish list.</div>
			<br><br>
            <input type="button" class="button" value="View My Wish List" onClick="window.open('os_myfav.php','_self')">
            <input type="button" class="button" value="Close" onClick="closeColorBox()">
		
		<? 
			}
			else
			{
				$insert=mysql_query("insert into os_favorite (uid,pid,add_datetime)values($member_id,$id,now())");
				
		?>
		<div class="dw_success"> This product has been added into your wish list!</div>	
		<br><br>
        <input type="button" class="button" value="View My Wish List" onClick="window.open('os_myfav.php','_self')">
        
        <input type="button" class="button" value="Close" onClick="closeColorBox()">
		<? 
			} }else{
		?>
        <div class="dw_failed">You have to login in order to use this feature </div>
			<br><br>
            <input type="button" class="button" value="Login" onClick="window.open('os_login.php','_self')">
            <input type="button" class="button" value="Close" onClick="closeColorBox()">
        <? } ?>
        </td>
        </table>
    </td>
  </tr>
  
</table>
